import { io } from './io'

export const queryRechargeList = (params: Api.Bill.RechargeSearchParams) =>
    io<Api.Bill.RechargeList>({
        url: '/api/v1/card/transaction/list',
        method: 'GET',
        params
    })

export const queryRemittanceList = (params: Api.Bill.RemittanceSearchParams) =>
    io<Api.Bill.RemittanceList>({
        url: '/api/v1/card/remit/list',
        method: 'GET',
        params
    })

export const queryNewRemittanceList = (params: Api.Bill.NewRemittanceSearchParams) =>
    io<Api.Bill.NewRemittanceList>({
        url: '/api/v1/card/remitnew/list',
        method: 'GET',
        params
    })

export const queryRemittanceDetail = (orderNumber: Api.Bill.Remittance['orderNumber']) =>
    io<Api.Bill.Remittance>({
        url: `/api/v1/card/remit/detail/${orderNumber}`,
        method: 'GET'
    })

export const queryNewRemittanceDetail = (orderNumber: Api.Bill.NewRemittance['orderNumber']) =>
    io<Api.Bill.NewRemittance>({
        url: `/api/v1/card/remitnew/detail/${orderNumber}`,
        method: 'GET'
    })

export const updateRemittanceStatus = (
    orderNumber: Api.Bill.Remittance['orderNumber'],
    status: Api.Bill.Remittance['status']
) =>
    io<{
        success: boolean
    }>({
        url: `/api/v1/card/remit/status/${orderNumber}`,
        method: 'PUT',
        data: {
            status
        }
    })

export const updateNewRemittanceStatus = (
    orderNumber: Api.Bill.NewRemittance['orderNumber'],
    status: Api.Bill.NewRemittance['status']
) =>
    io<{
        success: boolean
    }>({
        url: `/api/v1/card/remitnew/status/${orderNumber}`,
        method: 'PUT',
        data: {
            status
        }
    })

export const queryReserves = () =>
    io<Api.Bill.Reserves>({
        url: '/api/v1/card/reserves/info',
        method: 'GET'
    })

export const deposit = (data: { accountId: number; amount: string }) =>
    io<{
        result: boolean
    }>({
        url: '/api/v1/card/reserves/deposit',
        method: 'POST',
        data
    })

export const queryWalletList = (params: Api.Bill.WalletSearchParams) =>
    io<Api.Bill.WalletList>({
        url: '/api/v1/card/wallet/list',
        method: 'GET',
        params
    })

export const queryMasterCardList = (params: Api.Bill.MasterCardSearchParams) =>
    io<Api.Bill.MasterCardList>({
        url: '/api/v1/card/mastercard/transaction/list',
        method: 'GET',
        params
    })

export const exportRemittanceList = (params: Api.Bill.RemittanceSearchParams) =>
    io<Api.Bill.Export>({
        url: '/api/v1/card/remit/export',
        method: 'GET',
        params
    })

export const exportWalletList = (params: Api.Bill.WalletSearchParams) =>
    io<Api.Bill.Export>({
        url: '/api/v1/card/wallet/export',
        method: 'GET',
        params
    })

export const exportMasterCardList = (params: Api.Bill.MasterCardSearchParams) =>
    io<Api.Bill.Export>({
        url: '/api/v1/card/mastercard/transaction/export',
        method: 'GET',
        params
    })
